icontheme: fix emblemed icons fallout
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 25 Mar 2014 00:14:43 +0000 (20:14 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 25 Mar 2014 00:17:21 +0000 (20:17 -0400)
Commit faba7df4fea6cd09470b3b2cc277c35e6cf7c380 changed the logic in
apply_emblems() so that GtkIconInfo->emblems_applied would be set to
TRUE even in case there was no emblem info available, which confuses the
theme cache.
This commit changes the logic back, so that NULL is returned from
apply_emblems_to_pixbuf() when there are no emblems available, fixing
the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=726830

gtk/gtkicontheme.c

index 0eb44bd41664deb8df2567dec0b7b1a8214fd2fb..7b22921c81cd736a0e58845d1942ef932f0f0caf 100644 (file)
@@ -3578,7 +3578,7 @@ apply_emblems_to_pixbuf (GdkPixbuf *pixbuf,
   GSList *l;
 
   if (info->emblem_infos == NULL)
-    return g_object_ref (pixbuf);
+    return NULL;
 
   w = gdk_pixbuf_get_width (pixbuf);
   h = gdk_pixbuf_get_height (pixbuf);
@@ -3658,9 +3658,8 @@ apply_emblems (GtkIconInfo *info)
     {
       g_object_unref (info->pixbuf);
       info->pixbuf = icon;
+      info->emblems_applied = TRUE;
     }
-
-  info->emblems_applied = TRUE;
 }
 
 /* If this returns TRUE, its safe to call
@@ -4174,7 +4173,7 @@ symbolic_cache_get_proxy (SymbolicPixbufCache *symbolic_cache,
 }
 
 static GdkPixbuf *
-_gtk_icon_info_load_symbolic_internal (GtkIconInfo  *icon_info,
+_gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
                                       const GdkRGBA  *fg,
                                       const GdkRGBA  *success_color,
                                       const GdkRGBA  *warning_color,
@@ -4305,8 +4304,11 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo  *icon_info,
       GdkPixbuf *icon;
 
       icon = apply_emblems_to_pixbuf (pixbuf, icon_info);
-      g_object_unref (pixbuf);
-      pixbuf = icon;
+      if (icon != NULL)
+        {
+          g_object_unref (pixbuf);
+          pixbuf = icon;
+        }
 
       if (use_cache)
        {